package com.developer.platform.application.query;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.developer.platform.application.query.assembler.SystemAssembler;
import com.developer.platform.application.query.dto.SystemDto;
import com.developer.platform.domain.Systems;
import com.developer.platform.infrastructure.data.mapper.SystemMapper;
import java.util.List;
import org.springframework.stereotype.Component;

/**
 * @author ：qiaoliang
 * @date ：2020-12-29
 */
@Component
public class SystemQueryManager {

  private final SystemMapper systemMapper;
  private final SystemAssembler systemAssembler;

  public SystemQueryManager(
      SystemMapper systemMapper,
      SystemAssembler systemAssembler) {
    this.systemMapper = systemMapper;
    this.systemAssembler = systemAssembler;
  }

  public List<SystemDto> list(){
    LambdaQueryWrapper<Systems> queryWrapper = new LambdaQueryWrapper<>();
    return systemAssembler.toSystemDto(systemMapper.selectList(queryWrapper));
  }

}
